/**
 * Created By: sisopipo Project Team
 * Created Date: Feb 25, 2011
 */
package com.sisopipo.assetsportal.webui.action;

import java.util.Date;

import com.sisopipo.assetsportal.context.IAppSessionContext;
import com.sisopipo.assetsportal.security.ISecurityService;
import com.sisopipo.assetsportal.security.domain.User;
import com.sisopipo.core.controller.struts.action.AbstractProtectedAction;

/**
 * @author ribin
 * @version 1.0
 */
public class BaseProtectedAction extends AbstractProtectedAction {

	private static final long serialVersionUID = 1L;

	protected String pageTitle;

	private ISecurityService securityService;

	public final User getCurUser() {
		return ((IAppSessionContext) sessionContext).getUser();
	}

	public final String getCopyRight() {
		return getText("page_copyright_sisopipo");
	}

	public boolean hasPermission() {
		return securityService.hasPermission();
	}

	public boolean hasRight(String funcCode) {
		return securityService.hasPermission(funcCode);
	}

	public final void setSecurityService(ISecurityService securityService) {
		this.securityService = securityService;
	}

	public String getPageTitle() {
		return pageTitle;
	}

	public void setPageTitle(String pageTitle) {
		this.pageTitle = pageTitle;
	}

	public Date getCurrDate() {
		return new Date();
	}

}
